import numpy as np
import pandas as pd
arr = np.arange(1,10).reshape(3,3)
df1 = pd.DataFrame(arr,columns=['a','b','c'])
df1.insert(0,'key',['001','003','002'])
print('左对象df1: \n',df1)
arr2 = np.arange(10,14).reshape(2,2)
df2 = pd.DataFrame(arr2,columns=['a','e'])
df2.insert(0,'key',['001','004'])
print('右对象df2: \n',df2)
# df3 = pd.merge(df1,df2,how='left')
# print('左合并数据df3: \n',df3)
# df4 = pd.merge(df1,df2,how='left',on='key')
# print('key左合并数据df4: \n',df4)
# df6 = pd.merge(df1,df2,how='inner',on='key',suffixes=('_1','_r'))
# print('key内合并df6: \n',df6)
# df7 = pd.merge(df1,df2,how='outer',on='key',sort=True)
# print('key外合并df7: \n',df7)
df3= pd.concat(([df1,df2]))
print(df3)
df4=pd.concat([df1,df2],keys=['df1','df2'],sort=True)
print(df4)
df5=pd.concat([df1,df2],join='inner',ignore_index=True)
print(df5)